<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>

<script type="text/javascript">
	function addArtist() {
		$.post("/misc/artFind/insertArtist.htm", {
			detail : $("#detail").val(),
			name : $("#name").val(),
			photo : $("#photo").attr("src"),
			username : $("#username").val(),
			schoolid:$("#company").val(),
			provinceCode : $("#province").val(),
			cityCode : $("#city").val(),
			province : $("#province").find("option:selected").text(),
			city : $("#city").find("option:selected").text(),
			website : $("#website").val(),
			artviews : $("#artviews").val(),
			guestname : $("#guestname").val(),
			honor : $("#honor").val(),
			exhibition : $("#exhibition").val(),
			experience : $("#experience").val()
		}, function(data) {
			if (data == "success") {
				parent.artMadeGrid.loadData();
				alert("添加成功！");
			}
			if (data == "error") {
				alert("系统有点抽经，请稍候重试！");
			}
		});
	}

	function update() {
		$.post("/misc/artMade/updateArtist.htm", {
			id : $("#id").val(),
			detail : $("#detail").val(),
			name : $("#name").val(),
			photo : $("#photo").attr("src"),
			schoolid:$("#company").val(),
			provinceCode : $("#province").val(),
			cityCode : $("#city").val(),
			province : $("#province").find("option:selected").text(),
			city : $("#city").find("option:selected").text(),
			website : $("#website").val(),
			artviews : $("#artviews").val(),
			guestname : $("#guestname").val(),
			honor : $("#honor").val(),
			exhibition : $("#exhibition").val(),
			experience : $("#experience").val()
		}, function(data) {
			if (data == "success") {
				alert("修改成功！");
			}
			if (data == "error") {
				alert("系统有点抽经，请稍候重试！");
			}
		});
	}
</script>



<c:if test="${have eq 'no'}">
	<div>
		<table width="80%" class="def_t">
			<tr>
				<td style="text-align: center; color: red">添加艺术家</td>
			</tr>
		</table>
	</div>
</c:if>
<c:if test="${have eq 'have'}">
	<div>
		<table width="80%" class="def_t">
			<tr>
				<td style="text-align: center; color: blue">修改艺术家</td>
			</tr>
		</table>
	</div>
</c:if>
<table width="80%" class="def_t">
	<tr>
		<td>作者照片：</td>
		<td align="left" class="l-table-edit-td">
			<form id="upload_img_form" enctype="multipart/form-data"
				method="post" action="/misc/artPic/uploadImg.htm">
				<input type="file" onchange="uploadCmsImg(this);return false;"
					"  style="width: 200px;" title="支持jpg、jpeg、gif、png格式，文件小于2M"
					name="imagecontent" id="imagecontent" /> <img
					src="${artArtist.photo}" alt="" class="user_img" id="photo"
					width="100px;" height="100px" />
			</form></td>
	</tr>
</table>
<table width="80%" class="def_t" id="tab" border="1" cellpadding="0" cellspacing="0">
	<tr>
		<td>姓名：</td>
		<td colspan="3"><input type="text" id="name" name="name"
			value="${artArtist.name }" /> <input type="hidden" id="id" name="id"
			value="${artArtist.id}" /></td>
	</tr>
	<tr>
		<td>简介：</td>
		<td colspan="3"><textarea id="detail" name="detail" cols="200" style="width: 300px">${artArtist.detail}</textarea></td>
	</tr>
	<tr>
		<td>网址：</td>
		<td colspan="3"><textarea id="website" name="website" cols="200" style="width: 300px">${artArtist.website}</textarea></td>
	</tr>
	<tr>
		<td>艺术观点：</td>
		<td colspan="3"><textarea id="artviews" name="artviews" cols="200" style="width: 300px">${artArtist.artviews}</textarea></td>
	</tr>
	<tr>
		<td>客户名单：</td>
		<td colspan="3"><textarea id="guestname" name="guestname" cols="200" style="width: 300px">${artArtist.guestname}</textarea></td>
	</tr>
	<tr>
		<td>荣誉：</td>
		<td colspan="3"><textarea id="honor" name="honor" cols="200" style="width: 300px">${artArtist.honor}</textarea></td>
	</tr>
	<tr>
		<td>参展情况：</td>
		<td colspan="3"><textarea id="exhibition" name="exhibition" cols="200" style="width: 300px">${artArtist.exhibition}</textarea></td>
	</tr>
	<tr>
		<td>经历：</td>
		<td colspan="3"><textarea id="experience" name="experience" cols="200" style="width: 300px">${artArtist.experience}</textarea></td>
	</tr>
	<tr>
		<td>地区：</td>
		<td colspan="3">
			<select name="show_data" tabindex="10" id="province"> </select>
		    <select name="show_data" tabindex="10" id="city"> </select>
		</td>
	</tr>
	<tr>
		<td>学校：</td>
		<td colspan="3">
				<%@include file="../artFind/companyName.jsp"%>	
				<span><span style="color: red">*</span>请输入汉字，自动匹配查询</span>	   							
		</td>
	</tr>
	<tr>
		<td colspan="2" style="text-align: center;">
			<c:if test="${have eq 'no'}">
				<input type="button" value="添加" onclick="addArtist();" />
			</c:if> 
			<c:if test="${have eq 'have'}">
				<input type="button" value="更新" onclick="update();" />
			</c:if>
		</td>
	</tr>
</table>
<script type="text/javascript">
	initProvince('province','city');
	$(function() {
		provinceChange('province','city','', '','${artArtist.provinceCode }','${artArtist.cityCode }','', '');
	});
</script>
</body>
